package faw.car.ccenter;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.TextView;


import faw.car.ccenter.databinding.ActivityMainBinding;

import java.util.Objects;

public class MainActivity extends AppCompatActivity {
    private static final String TAG="MainActivity";

    private ActivityMainBinding binding;

    private final Handler mHandler = new Handler(Objects.requireNonNull(Looper.myLooper())) {
        @Override
        public void handleMessage(@NonNull Message msg) {
            super.handleMessage(msg);
        }
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.i(TAG, "onCreate Begin............");
        binding = ActivityMainBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());

        // Example of a call to a native method
        TextView tv = binding.sampleText;
        TextView pub = binding.pub;
        pub.setText("发布主题");
        pub.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

            }
        });
        
        TextView sub = binding.sub;
        sub.setText("订阅主题");
        sub.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                try {

                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });

        TextView unsub = binding.unsub;
        unsub.setText("取消订阅");
        unsub.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
            
            }
        });

        TextView registerCallback = binding.service;
        registerCallback.setText("注册Callback");
        registerCallback.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

            }
        });

        TextView unregisterCallback = binding.unService;
        unregisterCallback.setText("解注册Callback");
        unregisterCallback.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

            }
        });
        TextView rpcRequest = binding.client;
        rpcRequest.setText("RPC调用");
        rpcRequest.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

            }
        });

//        Message message = mHandler.obtainMessage();
//        mHandler.sendEmptyMessage(0);

        Log.i(TAG, "onCreate End............");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        Log.i(TAG, ">>>>>>>>>> onDestroy");
    }

}